<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>车次编辑 - 高铁订票系统</title>
    <link rel="stylesheet" th:href="@{/css/backend.css}">
    <style th:inline="css">
        .wrapper{
            background: url([[@{/image/bg.png}]]) fixed;
            background-size: cover;
        }
    </style>
</head>
<body>
<div class="wrapper">
    <div th:replace="commons/commons::topbar"></div>
    <div th:replace="commons/commons::sidebar"></div>
    <div class="content-page">
        <div class="container-fluid">
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-header d-flex justify-content-between">
                            <div class="header-title">
                                <h4 class="card-title">
                                    车次编辑
                                </h4>
                            </div>
                        </div>
                        <div class="card-body">
                            <form th:action="@{/admin/train/edit}" method="post">
                                <div class="form-group">
                                    <label for="id">车次编号</label>
                                    <input id="id" name="id" required class="form-control" th:value="${train.id}" th:readonly="${train.id!=null}" type="text" placeholder="请输入车次编号">
                                </div>
                                <div class="form-group">
                                    <label for="price">票价</label>
                                    <input id="price" name="price" required class="form-control" th:value="${train.price}" type="number" min="1" placeholder="请输入票价">
                                </div>
                                <div class="form-group">
                                    <label for="number">剩余票数</label>
                                    <input id="number" name="number" required class="form-control" th:value="${train.number}" type="number" min="1" placeholder="请输入票数">
                                </div>
                                <div class="form-group">
                                    <label for="startTime">出发时间</label>
                                    <input id="startTime" name="startTime" required class="form-control" th:value="${#dates.format(train.startTime,'yyyy-MM-dd HH:mm:ss')}" type="text" placeholder="如2021-11-19 11:12:13">
                                </div>
                                <div class="form-group">
                                    <label for="arriveTime">到达时间</label>
                                    <input id="arriveTime" name="arriveTime" required class="form-control" th:value="${#dates.format(train.arriveTime,'yyyy-MM-dd HH:mm:ss')}" type="text" placeholder="如2021-11-19 11:12:13">
                                </div>
                                <div class="form-group">
                                    <label for="startCity">出发城市</label>
                                    <select id="startCity" name="startCity" class="form-control">
                                        <option selected th:if="${train!=null}">请选择</option>
                                        <option th:each="city : ${cities}" th:value="${city.id}" th:text="${city.cityName}" th:selected="${train.startCity==city.id}"></option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="arriveCity">到达城市</label>
                                    <select id="arriveCity" name="arriveCity" class="form-control">
                                        <option selected th:if="${train!=null}">请选择</option>
                                        <option th:each="city : ${cities}" th:value="${city.id}" th:text="${city.cityName}" th:selected="${train.arriveCity==city.id}"></option>
                                    </select>
                                </div>
                                <button class="btn btn-primary" type="submit">提交</button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div th:replace="commons/commons::footer"></div>
</div>
<script th:src="@{/js/backend-bundle.min.js}"></script>
</body>
</html>